package com.tyk.bookstore.back.product.manager.excel.model;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ContentStyle;
import com.alibaba.excel.annotation.write.style.HeadFontStyle;
import com.alibaba.excel.annotation.write.style.HeadStyle;
import com.alibaba.excel.enums.poi.BorderStyleEnum;
import com.tyk.bookstore.back.common.core.util.FileUtil;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * @author tyk
 * @description 书籍
 */
@Data
@Accessors(chain = false)
@HeadStyle(fillForegroundColor = 9, borderBottom = BorderStyleEnum.THIN)
@HeadFontStyle(fontHeightInPoints = 11)
@ContentStyle(borderTop = BorderStyleEnum.THIN, borderBottom = BorderStyleEnum.THIN, borderLeft = BorderStyleEnum.THIN, borderRight = BorderStyleEnum.THIN)
public class BookExcelVo implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @ExcelProperty("id")
    private String id;

    @ExcelProperty("书籍编号")
    private String bookNo;

    @ExcelProperty("书名")
    private String name;

    @ExcelProperty("价格")
    private BigDecimal price;

    @ExcelProperty("封面路径")
    private String cover;

    @ExcelProperty("标题")
    private String title;

    @ExcelProperty("书籍简介")
    private String summary;

    @ExcelIgnore
    private String authorId;

    @ExcelProperty("作者名称")
    private String authorName;

    @ExcelIgnore
    private String publisherId;

    @ExcelProperty("出版社名称")
    private String publisherName;

    @ExcelProperty("出版时间")
    private LocalDateTime publishTime;

    @ExcelProperty("ISBN")
    private String isbn;

    @ExcelIgnore
    private Long clazzId;

    @ExcelProperty("分类")
    private String clazzFullName;

    @ExcelProperty("字数[单位：万字]")
    private BigDecimal wordNum;

    @ExcelProperty("重量[单位：克]")
    private Long weight;

    @ExcelProperty("规格")
    private Integer format;

    @ExcelProperty("状态[0下架，1上架]")
    private String state;

    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    @ExcelProperty("更新时间")
    private LocalDateTime updateTime;

    @ExcelProperty("收藏人数")
    private Long collectNum;

    @ExcelProperty("支付人数")
    private Long payNum;

    @ExcelProperty("评论人数")
    private Long commentNum;

    @ExcelProperty("销量")
    private Long saleNum;

    @ExcelProperty("点赞人数")
    private Long likeNum;

    public void setCover(String cover) {
        this.cover = FileUtil.relativePath(cover);
    }
}
